﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using XReactor.XSockets;
using GalaSoft.MvvmLight.Messaging;

namespace ConsoleApplication1.XInterface
{
    public partial class LoginPanel : Form
    {
         XReactorSockets MySokcets;
        public LoginPanel(XReactorSockets xrs)
        {
            
            InitializeComponent();
            label1.Visible = false;
            this.MySokcets = xrs;
            Messenger.Default.Register<string>("loginform", "asdas", new Action<string>(OnMessengerReceive));
        }

        private void formuac(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.button1.Enabled = false;
            MySokcets.TryConnect();
            this.button1.Enabled = true;
        }
        private void OnMessengerReceive(string d)
        {
            if (d == "TRY_TO_CONNECT")
            {
                label1.Text = "Bağlanmaya çalşıyor...";
                label1.Visible = true;
            }
        }
    }
}
